﻿// ***********************************************************************
// <copyright file="Principal.cs" company="MS Yammer">
//     Copyright (c) MS Yammer. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************

using System;

namespace ContractMeow.Api.Dtos
{
	/// <summary>
	/// Class Principal
	/// </summary>
    public class Principal
    {
		/// <summary>
		/// Initializes a new instance of the <see cref="Principal" /> class.
		/// </summary>
        public Principal() { }

		/// <summary>
		/// Initializes a new instance of the <see cref="Principal" /> class.
		/// </summary>
		/// <param name="authEnvelope">The auth envelope.</param>
        public Principal(AuthEnvelope authEnvelope)
        {
            UserId = authEnvelope.AccessToken.UserId;
            NetworkId = authEnvelope.AccessToken.NetworkId;
            AccessToken = authEnvelope.AccessToken.Token;
            AuthorizedAt = authEnvelope.AccessToken.AuthorizedAt;
            ExpiresAt = authEnvelope.AccessToken.ExpiresAt;
        }

		/// <summary>
		/// Gets or sets the user id.
		/// </summary>
		/// <value>The user id.</value>
        public Int64 UserId { get; set; }
		/// <summary>
		/// Gets or sets the network id.
		/// </summary>
		/// <value>The network id.</value>
        public Int64 NetworkId { get; set; }
		/// <summary>
		/// Gets or sets the access token.
		/// </summary>
		/// <value>The access token.</value>
        public String AccessToken { get; set; }
		/// <summary>
		/// Gets or sets the authorized at.
		/// </summary>
		/// <value>The authorized at.</value>
        public DateTimeOffset AuthorizedAt { get; set; }
		/// <summary>
		/// Gets or sets the expires at.
		/// </summary>
		/// <value>The expires at.</value>
        public DateTimeOffset? ExpiresAt { get; set; }
    }
}